package dynamicproxy.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author hht
 * @ClassName JdkProxy
 * @Description TODO
 * @Date 2019/5/28 14:24
 * @VERSION 1.0
 */
public class JdkProxy implements InvocationHandler {
    private Object target;

    public JdkProxy(Object target){
        this.target = target;
    }
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        before();
        Object obj = method.invoke(this.target,args);
        after();
        return obj;
    }
    private  void  before(){
        System.out.println("资料调查");
    }
    private  void  after(){
        System.out.println("收钱");
    }

}
